<?php 
/*
Plugin Name: Seta slider
*/
class Seta_slider_Widget extends WP_Widget{

  public function __construct() {
        parent::__construct(false,$name = __('Seta Slider Show'));
  }
  public function widget( $args,$instanse ){

    if(isset($instanse['show_post_widget_title'])){
        $widget_title = $instanse['show_post_widget_title'];
    }

    if(isset($instanse['show_post_widget_cat_value'])){
        $cat_id = $instanse['show_post_widget_cat_value'];
    }

    if(isset($instanse['num_post'])){
        $num_post = $instanse['num_post'];
    }
?>
<!-- output html -->
<div id="mainVisual">
  <div id="da-slider">
    <div class="slide">
        <h2 data-position="90,370" data-delay="100">We know business</h2>
        <p data-position="160,280" data-delay="400">Morbi enim diam, ullamcorper ut malesuada quis, lacinia ut urna</p>
        <p data-position="230,500" data-delay="300"><a href="javascript:void(0)" class="btn btn-primary da-link" role="button">Xem thêm</a></p>
    </div>
    <div class="slide">
        <h2 data-position="90,340" data-delay="100" data-in="left" data-out="left">We know technology</h2>
        <p data-position="160,280" data-delay="400" data-in="left" data-out="left">Morbi enim diam, ullamcorper ut malesuada quis, lacinia ut urna</p>
        <p data-position="230,500" data-delay="300" data-in="left" data-out="left"><a href="javascript:void(0)" class="btn btn-primary da-link" role="button">Xem thêm</a></p>
    </div>
    <div class="slide">
        <h2 data-position="90,425" data-delay="100" data-in="top" data-out="right">We are global </h2>
        <p data-position="160,280" data-delay="400" data-in="top" data-out="right">Morbi enim diam, ullamcorper ut malesuada quis, lacinia ut urna</p>
        <p data-position="230,500" data-delay="300" data-in="top" data-out="right"><a href="javascript:void(0)" class="btn btn-primary da-link" role="button">Xem thêm</a></p>
    </div>
  </div>
</div>
<?php 
  }
  public function form( $instanse ){

    $instance = wp_parse_args( (array) $instance, $defaults );

    if(isset($instanse['show_post_widget_cat_value'])){
        $show_post_widget_cat_value = $instanse['show_post_widget_cat_value'];
    }
    
    if(isset($instanse['show_post_widget_title'])){
        $show_post_widget_title = $instanse['show_post_widget_title'];
    }
    
    if(isset($instanse['num_post'])){
        $num_post = $instanse['num_post'];
    }
?>
<!-- Widget form -->
<p>Title:<input type="text" name="<?php echo $this->get_field_name('show_post_widget_title'); ?>" value="<?php echo $show_post_widget_title; ?> " /></p>
<?php    
  }
  public function update($new_instance,$old_instance){
    $instance = $old_instance;
      
    $instance['show_post_widget_cat_value'] = (!empty($new_instance['show_post_widget_cat_value'])) ? 
    strip_tags($new_instance['show_post_widget_cat_value']) : '';
    
    $instance['show_post_widget_title'] = (!empty($new_instance['show_post_widget_title'])) ? 
    strip_tags($new_instance['show_post_widget_title']) : '';
    
    $instance['num_post'] = (!empty($new_instance['num_post'])) ? 
    strip_tags($new_instance['num_post']) : '';
    
    return $instance;
  }
}
add_action('widgets_init',function(){register_widget('Seta_slider_Widget');});